<%@ Page Language="C#" ValidateRequest="false" MasterPageFile="~/Admin/AdminDefault.master" AutoEventWireup="true" CodeFile="EditOrder.aspx.cs" Inherits="EditOrder_Page" Title="Edit Order" %>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" Runat="Server">
    <br />
    <div class="sectiontitle">Manage Order</div>
   <p></p>
   <asp:DetailsView ID="dvwOrder" runat="server" AutoGenerateEditButton="True"
      AutoGenerateRows="False" DataKeyNames="OrderId" DataSourceID="objCurrOrder"
      DefaultMode="Edit" HeaderText="Order Details" style="margin-right: 17px">
      <FieldHeaderStyle Width="100px" />
      <Fields>
         <asp:BoundField DataField="OrderNo" HeaderText="Order No." ReadOnly="True" />
         <asp:BoundField DataField="AddedDate" HeaderText="Added Date" ReadOnly="True" HtmlEncode="false" DataFormatString="{0:f}" />
         <asp:TemplateField HeaderText="Customer">
            <ItemTemplate>
               <asp:HyperLink runat="server" ID="lnkCustomer" Text='<%# Eval("UserName") %>'/>
            </ItemTemplate>
         </asp:TemplateField>
         <%--<asp:TemplateField HeaderText="Address">
            <ItemTemplate>
               <%# Eval("ShippingFirstName") %> <%# Eval("ShippingLastName") %><br />
               <%# Eval("ShippingStreet") %><br />
               <%# Eval("ShippingCity") %>, <%# Eval("ShippingState") %> <%# Eval("ShippingPostalCode") %><br />
               <%# Eval("ShippingCountry") %>
            </ItemTemplate>
         </asp:TemplateField>--%>
         <asp:TemplateField HeaderText="Items">
            <ItemTemplate>
               <asp:Repeater runat="server" ID="repOrderItems" DataSource='<%# Eval("OrderItems") %>'>                  
                  <ItemTemplate>
                     <img src="../../Images/ArrowR3.gif" border="0" alt="" />                      
                      <%--<asp:HyperLink runat="server" ID="lnkProduct" Text='<%# Eval("Title") %>'
                        NavigateUrl='<%# "~/ShowProduct.aspx?ID=" + Eval("ProductID") %>' />--%>
                     <small>(Title = <%# Eval("Title") %>) - Price = <%# Eval("UnitPrice") %></small>
                     <br />
                  </ItemTemplate>
               </asp:Repeater>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField DataField="SubTotal" HeaderText="Subtotal" ReadOnly="True" HtmlEncode="false" />         
         <asp:TemplateField HeaderText="Total" >
            <ItemTemplate>
               <%# (decimal)Eval("SubTotal")%>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Status">
            <ItemTemplate>
               <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:DropDownList ID="ddlOrderStatuses" runat="server" SelectedValue='<%# Eval("Status") %>' DataSourceID="objAllStatuses" Width="100%"/>
               <asp:ObjectDataSource ID="objAllStatuses" runat="server" SelectMethod="GetOrderStatuses"
                  TypeName="Ample.BLL.Store.OrderBO"></asp:ObjectDataSource>   
            </EditItemTemplate>
         </asp:TemplateField>         
      </Fields>
   </asp:DetailsView>
   <asp:ObjectDataSource ID="objCurrOrder" runat="server"
      SelectMethod="GetOrderByNo" TypeName="Ample.BLL.Store.OrderBO" UpdateMethod="UpdateOrderImplicit" 
        DataObjectTypeName="Ample.Model.Order" 
        OldValuesParameterFormatString="original_{0}" 
        onupdating="objCurrOrder_Updating">
      <SelectParameters>
         <asp:QueryStringParameter Name="orderNo" QueryStringField="ID" Type="String" />
      </SelectParameters>
   </asp:ObjectDataSource>     
</asp:Content>

